function IsPopOrder(pushV, popV)
{
    // write code here
    if(pushV.length === 0 && popV.length === 0) return true
    if(pushV.length === 0 || popV.length === 0) return false
    var stack = []
    var popIndex = 0
    for(let i of pushV){
       stack.push(i)
       while(stack.length !== 0 && stack[stack.length - 1] === popV[popIndex]){
          stack.pop()
          popIndex++
       }
    }
    return stack.length === 0
}
module.exports = {
    IsPopOrder : IsPopOrder
};